﻿namespace Core
{
    public class DelayInst : Core.Component, IInstruction, IAwake<float>,
        IStartUpdateFinish
    {
        public bool IsComplete { get; private set; }

        private float duration;
        private float startTime;

        public void Awake(float time)
        {
            duration = time;
        }

        public void Start()
        {
            startTime = UnityEngine.Time.time;
            IsComplete = false;
        }

        public void Update()
        {
            if (UnityEngine.Time.time - startTime >= duration)
            {
                IsComplete = true;
            }
        }

        public void Finish()
        {

        }
    }
}
